package com.atguigu.day28.work;

import org.junit.After;
import org.junit.BeforeClass;
import org.junit.Test;

import java.util.ArrayList;

public class Work6 {
    private static Admin ad = new Admin();
@BeforeClass
    public static void test1() {
        ad.add(new Employee(1, "张三", 10000, 23, '男'));
        ad.add(new Employee(2, "李四", 12000, 33, '男'));
        ad.add(new Employee(3, "王五", 6000, 25, '女'));
        ad.add(new Employee(4, "赵六", 7000, 21, '女'));
        ad.add(new Employee(5, "钱七", 8000, 20, '男'));
    }
    @Test
    public void test01(){
    System.out.println(ad.size());
    }
    @After
    public void test(){
        System.out.println("编号偶数:");
        ArrayList<Employee> list=ad.get(e->e.getId()%2==0);
        for (Employee employee : list) {
            System.out.println(employee);
        }
        System.out.println("低于10000:");
        ArrayList<Employee> list1=ad.get(e->e.getMoney()<10000);
        for (Employee employee : list1) {
            System.out.println(employee);
        }
        System.out.println("年龄大于30的女");
        ArrayList<Employee> list2=ad.get(employee ->employee.getAge()>30&&employee.getSex()=='女' );
        for (Employee employee : list2) {
            System.out.println(employee);
        }
        System.out.println("姓张");
        ArrayList<Employee> list3=ad.get(employee -> employee.getName().startsWith("张"));
        for (Employee employee : list3) {
            System.out.println(employee);
        }
        System.out.println("所有");
        ArrayList<Employee> list4=ad.get(employee -> true);
        for (Employee employee : list4) {
            System.out.println(employee);
        }
        System.out.println();
    }
}
